/***************************************************************************
 *   Copyright (C) 2008 by BogDan Vatra                                    *
 *   bogdan@licentia.eu                                                    *
 *                                                                         *
 *   This program is free software: you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation, either version 3 of the License, or     *
 *   (at your option) any later version.                                   *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>. *
 ***************************************************************************/
#include <QtCore>

#include "judeteplugin.h"
#include "judete.h"

inline void initMyResource()
{
	Q_INIT_RESOURCE(judete);
}

JudetePlugin::JudetePlugin(QObject *parent):QObject(parent)
{
	initMyResource();

}

KontAMabilWindow * JudetePlugin::createWidget(QWidget * parent)
{
	Judete * m_widget = new Judete(parent);
	m_widget->setObjectName(name());
	return m_widget;
}

QIcon JudetePlugin::icon(const QString &)
{
	return QIcon(":/judete/judete.png");
}

QString JudetePlugin::querys()
{
	QFile f(":/judete/sql.xml");
	if (!f.open(QIODevice::ReadOnly))
		return QString();
	QString querys=f.readAll();
	f.close();
	return querys;
}

int JudetePlugin::order()
{
	return 11;
}

int JudetePlugin::menuGroup(const QString &)
{
	return 0;
}

QString JudetePlugin::toolTip(const QString &)
{
	return "Actualizare judete";
}

bool JudetePlugin::add(QWidget * /*parent*/, const QString & addStr, QString * result, qint64 * id)
{
	bool res=false;
	Judete * widget = new Judete;
	res=widget->addJudet(addStr, result, id);
	delete widget;
	return res;
}

QString JudetePlugin::name()
{
	return "judete";
}

QString JudetePlugin::version()
{
	return "0.1";
}

QString JudetePlugin::depends()
{
	return "tari";
}

QString JudetePlugin::recommends()
{
	return "Contabilitate|Gestiune|Salarizare|Car";
}

QString JudetePlugin::description(const QString &)
{
	QFile f(":/judete/doc.html");
	if (!f.open(QIODevice::ReadOnly))
		return QString();
	QString doc=f.readAll();
	f.close();
	return doc;
}

QStringList JudetePlugin::menus()
{
	return QStringList()<<"/Contabilitate/Actualizare Baza/Judete"<<"/Gestiune/Actualizare Baza/Judete"<<"/Salarizare/Actualizare Baza/Judete"<<"/Facturare/Actualizare Baza/Judete";
}

Q_EXPORT_PLUGIN2(judetePlugin, JudetePlugin);
